from flask import Flask, render_template, request,jsonify
from panduan import panduan_login

app = Flask(__name__)

@app.route('/')
def hello() -> str:
	return "hello wrold"


@app.route('/search',methods = ['POST'])
def search():
	phrase = request.form["phrase"]
	letters = request.form["letters"]
	a = panduan_login(phrase, letters)
	print(a)
	if a =="true":
		return render_template('results.html',the_title ="登录成功，欢迎进入主页！")
	else:
		return "账号密码错误，登录失败！"

@app.route('/entry')
def entry_page() -> 'html':
	return render_template('entry.html',the_title ="welcome to searchletters on the web!")

@app.route('/results',methods = ['GET'])
def results_page() -> 'html':
	return render_template('results.html',the_title ="welcome to searchletters on the web!")


if __name__ == '__main__':
	app.run(debug = True)